package com.otherTest.designpattern.creationalpattern.singleton.hungry;

/**
 * @Description: 饿汉式单例
 * 非懒加载，是线程安全
 * @author: conceit
 * @Date: 2018/8/29 0029 15:51
 */
public class SingleHungryBaseObject {
    /**
     *私有化构造方法
    */
    private SingleHungryBaseObject(){}

    /**
     * 饿汉式加载
     */
    private static SingleHungryBaseObject instance=new SingleHungryBaseObject();

    /**
     * 获取单例
     */
    public static SingleHungryBaseObject getInstance(){
        return instance;
    }

    /**
     *测试方法
     */
    public void showMessage(){
        System.out.println(this.getClass().getName()+"--->this is showMessage");
    }



}
